require_relative 'operational_laws'

# Example 33.1
puts 'Example 33.1'

xi = 125.0
si = 0.002

puts "should: 0,25"
puts "value #{utilization_law(xi, si)}"

# Example 33.2
puts 'Example 33.2'
d = {}
v = {}
x = {}
s = {}
u = {}

s[:a] = 0.050
s[:b]= 0.030
n = 17.0
x[:a] = 15.70
v[:a] = 80.0
v[:b] = 100.0
v[:cpu] = v[:a] + v[:b] + 1
z = 18

d[:cpu] = 5.0
d[:a] = 4.0
d[:b] = 3.0

x[:s] = forced_flow_law(x[:a], 1/v[:a])

u[:cpu] = utilization_law(x[:s], d[:cpu])
u[:a] = utilization_law(x[:a], s[:a])
u[:b] = utilization_law(x[:s], s[:b], v[:b])

puts "Ucpu: #{u[:cpu]}"
puts "Ua: #{u[:a]}"
puts "Ub: #{u[:b]}"


# Example 33.4
puts 'Example 33.4'

x[:cpu] = 35.48
x[:b] = 19.6
q = {}
q[:cpu] = 8.88
q[:a] = 3.19
q[:b] = 1.40

r = {}
r[:cpu] = littles_law(1/x[:cpu] , q[:cpu])
r[:a] = littles_law(1/x[:a] , q[:a])
r[:b] = littles_law(1/x[:b] , q[:b])

puts "Rcpu: #{r[:cpu]}"
puts "Ra: #{r[:a]}"
puts "Rb: #{r[:b]}"
